﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace navegador.net
{
    public partial class TelaPrincipal : Form
    {
        public TelaPrincipal()
        {
            InitializeComponent();
        }

        private void ir(object sender, EventArgs e)
        {
            String link = txtAcesso.Text;
            String addLink = "";

            if ((link.Length < 7) || (!link.Substring(0, 7).Equals("http://")))
            {
                addLink = "http://";

                if (!((link.Length > 8) && link.Substring(0,9).Equals("localhost")) && !link.Substring(0, 4).Equals("www."))
                {
                    addLink = addLink + "www.";
                }
            }

            //System.Windows.Forms.MessageBox.Show(addLink + link);
            this.webBrowser1.Url = new System.Uri(addLink + link, System.UriKind.Absolute);
        }
    }
}
